<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name:{{ this.customerInfo.customerInfo.username }}</div>
    <div class="dashboard-text">phone:{{ this.customerInfo.customerInfo.phone }}</div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import cookie from 'js-cookie'
export default {
  name: 'Dashboard',
  computed: {
    ...mapGetters([
      'name',
      'roles'
    ])
  },
  data(){
    return{
      token: "",
      customerInfo:{
        id:"",
        username:"",
        phone:"",
        password:"",
        gmtCreate:"",
        gmtModified:""
      }
    }
  },
  created() {
    this.getCustomerInfo()
  },
  methods:{
    //从cookie中获取用户信息
    getCustomerInfo(){
      let jsonStr = cookie.get('noqueue-customerInfo')
      // console.log(jsonStr)
      if(jsonStr){
        this.customerInfo = JSON.parse(jsonStr) //字符串转换为对象
        // this.customerInfo = jsonStr
        console.log(this.customerInfo)
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
